# -*- coding: utf-8 -*-
"""
Created on Tue Aug 14 20:43:19 2018

@author: Hy
"""

import requests


def post_html_text(url, data):
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
    }
    try:
        r = requests.post(url, timeout=30, data=data, headers=headers)
        r.raise_for_status()
        r.encoding = r.apparent_encoding
        return r.text
    except Exception as e:
        print(e)


data = {
    'cid': '0',
    'stale_ids': '252,706,853',
    'page': '2'
}
url = 'http://www.xhcjtv.com/portal/index/ajaxgetarticle.html'
text = post_html_text(url, data)#得到页面text，可进一步处理
print(text)